from tw.api import WidgetsList,CSSLink
from tw.forms import TableForm, TextField, TextArea,HiddenField,RadioButtonList
from tg import url
from comboselect import ComboSelect
from tw.forms.validators import All,NotEmpty,UnicodeString,Int

class TermForm(TableForm):
    #template='lifepyscle.widgets.templates.table_form'
    hover_help = True
    submit_text = "Add Term"
    action='/term/add'
    class fields(WidgetsList):
        record_id = HiddenField(id='record_id',validator=All(NotEmpty(),Int()))
        term_type = RadioButtonList(id='term_type',label_text=u'Right or Obligation?',validator=NotEmpty(),options=['right','obligation'],attrs=dict(style='list-style:none;display:inline;'))
        description = TextArea(id="description",validator=UnicodeString(),label_text=u"Description:",\
                help_text=u"Enter a good description of the term. You could paste the text of the corresponding clause in the contract agreement here...",\
                attrs=dict(style="width:100%;height:50px;"))

term_form = TermForm("term_form",action=url('/term/add'))
